﻿using System.ComponentModel.DataAnnotations;
using OpusSuite.Utility;
using OpusSuite.Models.Model.Shared;
using OpusSuite.Globalisation.Attributes;
using OpusSuite.Globalisation.Resources;

namespace OpusSuite.Models.Model.Ref
{
    [Table("country")]
    public class Country : ModelBase
    {
        [Key]
        public int Id { get; set; }

        [OpusDisplay(Enums.OpusSuiteResource.Ref, "Country_Code_DisplayName")]
        [StringLength(20, MinimumLength=2,
            ErrorMessageResourceName = "Country_Code_StringLengthWarning",
            ErrorMessageResourceType = typeof(ModelRef)
            )]
        [Required(
            ErrorMessageResourceName = "Country_Code_Required",
            ErrorMessageResourceType = typeof(ModelRef)
            )]
        public string Code { get; set; }

        [OpusDisplay(Enums.OpusSuiteResource.Ref, "Country_Name_DisplayName")]
        [StringLength(30, MinimumLength = 2,
            ErrorMessageResourceName = "Country_Name_StringLengthWarning",
            ErrorMessageResourceType = typeof(ModelRef)
            )]
        [Required(
            ErrorMessageResourceName = "Country_Name_Required",
            ErrorMessageResourceType = typeof(ModelRef)
            )]
        public string Name { get; set; }

        [OpusDisplay(Enums.OpusSuiteResource.Ref, "Country_Description_DisplayName")]
        [StringLength(256,
            ErrorMessageResourceName = "Country_Description_StringLengthWarning",
            ErrorMessageResourceType = typeof(ModelRef)
            )]
        [Required(
            ErrorMessageResourceName = "Country_Description_Required",
            ErrorMessageResourceType = typeof(ModelRef)
            )]
        public string Description { get; set; }

        public virtual Language Language { get; set; }
        public virtual MoneyFormat MoneyFormat { get; set; }
        public virtual DateFormat DateFormat { get; set; }
    }
}
